define(function(require) {
    var $ = require('jquery');
    $(function(){
        $.getJSON( '/dy/getctm/', function(Products){
                var html = [];
                for(var i=0;i<Products.length;i++){
                    var sumScore =
                        (parseFloat(Products[i].lv1) * 1) +
                            (parseFloat(Products[i].lv2) * 2) +
                            (parseFloat(Products[i].lv3) * 3) +
                            (parseFloat(Products[i].lv4) * 4) +
                            (parseFloat(Products[i].lv5) * 5);
                    var people =
                        parseFloat(Products[i].lv1) + parseFloat(Products[i].lv2) +
                            parseFloat(Products[i].lv3) + parseFloat(Products[i].lv4) +
                            parseFloat(Products[i].lv5);

                    var score =Math.ceil((parseFloat(sumScore) / parseFloat(people))*2);
                    var score2 = (score - Math.floor(score))*2;

                    html.push('<li ><a target="_blank" title="'+Products[i].content_title+'" ' +
                        'href="/movie/s/1/'+Products[i].content_id+'">'+Products[i].content_title+'</a>&nbsp; ' +
                        '<span style="float: right">'+score+'.'+score2+'</span></li>');
                }
                $('#score_top_movie').html(html.join(''));
        });
    });
});